﻿using System.Web.Mvc;
using System.Linq;
using Citi.Scheduler.Domain;
using Citi.Scheduler.WebUi.Models;

namespace Citi.Scheduler.WebUi.Controllers
{
    public class LibraryController : ControllerBase<LibraryModel, Library>
    {
        public ActionResult Index()
        {
            IndexBase(true);
            return PartialView(Models.OrderBy(x => x.Name));
        }

        public ActionResult Form()
        {
            return View();
        }

        [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
        public ActionResult ActionForm(int? id)
        {
            return ActionBase(id, true);
        }

        [HttpPost]
        public ActionResult ActionForm(LibraryModel model)
        {
            model.Active = true;
            return ActionBase(model, true);
        }

        public ActionResult Delete(int id)
        {
            return DeleteBase(id, true);
        }
    }
}
